class MinStack {
public:
    stack<int>stk;
    stack<int>minstk;
    int minnum = INT_MAX;
    MinStack() {
        
    }
    void push(int val) {
        if (!minstk.empty()) { minnum = min(minstk.top(), val); }
        else { minnum = INT_MAX; minnum = min(minnum, val); }
        stk.push(val);
        minstk.push(minnum);
    }

    void pop() {
        stk.pop();
        minstk.pop();
    }

    int top() {
        return stk.top();
    }

    int getMin() {
        return minstk.top();
    }
};